Copyright © 2015 Lua.org, PUC-Rio. Freely available under the terms of the Lua license.
QSC Note: We have compiled the Lua 5.3 environment (contained in the Q-SYS 5.1 and higher releases) with 5.2 compatibility enabled (FYI, Lua v5.2 was used in Q-SYS versions v4.0-v5.0). Therefore, any previous Lua scripts written in the Q-SYS Script v2 environments will continue to function under Lua 5.3. However, new scripts should use the latest Lua 5.3 methods and libraries to avoid any future incompatibilities. Pay special attention to language in this section related to syntax and methods being 'depreciated.' In Q-Sys 5.1 and above, depreciated Lua 5.2 functions will continue to work, but may not be able to function if we upgrade later to Lua 6.0.
Here we list the incompatibilities that you may find when moving a program
from Lua 5.2 to Lua 5.3.
You can avoid some incompatibilities by compiling Lua with
appropriate options (see file luaconf.h
).
However,
all these compatibility options will be removed in the future.
Lua versions can always change the C API in ways that do not imply source-code changes in a program, such as the numeric values for constants or the implementation of functions as macros. Therefore, you should not assume that binaries are compatible between different Lua versions. Always recompile clients of the Lua API when using a new version.
Similarly, Lua versions can always change the internal representation of precompiled chunks; precompiled chunks are not compatible between different Lua versions.
The standard paths in the official distribution may change between versions.
You can fix these differences by forcing a number to be a float
(in Lua 5.2 all numbers were float),
in particular writing constants with an ending .0
or using x = x + 0.0
to convert a variable.
(This recommendation is only for a quick fix
for an occasional incompatibility;
it is not a general guideline for good programming.
For good programming,
use floats where you need floats
and integers where you need integers.)
.0
suffix
to the result if it looks like an integer.
(For instance, the float 2.0 will be printed as 2.0
,
not as 2
.)
You should always use an explicit format
when you need a specific format for numbers.
(Formally this is not an incompatibility, because Lua does not specify how numbers are formatted as strings, but some programs assumed a specific format.)
bit32
library has been deprecated.
It is easy to require a compatible external library or,
better yet, to replace its functions with appropriate bitwise operations.
(Keep in mind that bit32
operates on 32-bit integers,
while the bitwise operators in Lua 5.3 operate on Lua integers,
which by default have 64 bits.)
ipairs
iterator now respects metamethods and
its __ipairs
metamethod has been deprecated.
atan2
, cosh
, sinh
, tanh
, pow
,
frexp
, and ldexp
.
You can replace math.pow(x,y)
with x^y
;
you can replace math.atan2
with math.atan
,
which now accepts one or two parameters;
you can replace math.ldexp(x,exp)
with x * 2.0^exp
.
For the other operations,
you can either use an external library or
implement them in Lua.
require
changed the way it handles versioned names.
Now, the version should come after the module name
(as is usual in most other tools).
For compatibility, that searcher still tries the old format
if it cannot find an open function according to the new style.
(Lua 5.2 already worked that way,
but it did not document the change.)
collectgarbage("count")
now returns only one result.
(You can compute that second result from the fractional part
of the first result.)
© 2009 - 2016 QSC, LLC. All rights reserved. QSC and the QSC logo are trademarks of QSC, LLC in the U.S. Patent and Trademark office and other countries. All other trademarks are the property of their respective owners.
http://patents.qsc.com.